package com.gyg.controller;


import com.gyg.client.CloudSpaceClient;
import com.gyg.domain.CloudUser;
import com.gyg.enums.SessionEnum;
import com.gyg.returns.RespCode;
import com.gyg.returns.RespEntity;
import com.gyg.returns.RespTable;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
import java.util.Objects;

/**
 * <p>
 * 云盘空间表 前端控制器
 * </p>
 *
 * @author gyg
 * @since 2021-04-14
 */
@RestController
@RequestMapping("/cloud-space")
@Api(value = "容量模块", tags = "容量模块")
@Slf4j
public class CloudSpaceController {

    @Resource
    private CloudSpaceClient cloudSpaceClient;

    @ApiOperation(value = "用户容量总览")
    @GetMapping("/user")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "page", value = "当前页数", required = true),
            @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "limit", value = "当前页数", required = true),
            @ApiImplicitParam(paramType = "query", dataType = "String", name = "username", value = "用户账号", required = false)
    })
    public RespTable cloudRecordList(@RequestParam(value = "page", required = true) Integer page,
                                     @RequestParam(value = "limit", required = true) Integer limit,
                                     @RequestParam(value = "username", required = false) String username) {
        RespTable respTable = cloudSpaceClient.cloudSpaceUser(page, limit, username);
        return respTable;
    }

    @GetMapping("/file")
    @ApiOperation(value = "文件容量总览")
    public RespEntity spaceFileList() {
        RespEntity respEntity = cloudSpaceClient.cloudSpaceFileList();
        return respEntity;
    }

    @GetMapping("/cloud")
    @ApiOperation(value = "云盘容量总览")
    public RespEntity spaceCloud() {
        RespEntity respEntity = cloudSpaceClient.spaceCloud();
        return respEntity;
    }
}
